package net.zjitc.service.impl;

import net.zjitc.dao.product.ProductDao;
import net.zjitc.dao.product.impl.ProductDaoImpl;
import net.zjitc.domain.Product;
import net.zjitc.service.product.ProductService;

import java.util.List;

/**
 * Created by hasee on 2017/10/23.
 */
public class ProductServiceImpl implements ProductService {
    @Override
    public List<Product> findAll() {
        ProductDao dao = new ProductDaoImpl();
        return dao.findAll();
    }

    @Override
    public void removeById(String id) {
        ProductDao dao = new ProductDaoImpl();
        dao.removeById(id);
    }

    @Override
    public void insert(Product product) {
        ProductDao dao = new ProductDaoImpl();
        dao.insert(product);
    }

    @Override
    public Product findById(String id) {
        ProductDao dao = new ProductDaoImpl();
        return dao.findById(id);
    }

    @Override
    public void update(Product product) {
        ProductDao dao = new ProductDaoImpl();
        dao.update(product);
    }

    @Override
    public List searchByPage(int page) {
        ProductDao dao =new ProductDaoImpl();
        return dao.searchByPage(page);
    }

    @Override
    public List<Product> findByKeyword(String keyword) {
        ProductDao dao = new ProductDaoImpl();
        return dao.findByKeyword(keyword);
    }
}
